package com.demo.shangguigu.completableFuture;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;


public class CompletableFutureDemo
{
    public static void main(String[] args) throws ExecutionException, InterruptedException
    {
        FutureTask<String> futureTask = new FutureTask<>(new MyThread());

        Thread t1 = new Thread(futureTask,"t1");
        t1.start();

        CompletableFuture.runAsync(()->{
            System.out.println("kkkk");
        }).thenRun(()->{
            System.out.println("mmmmm");
        });

        System.out.println(futureTask.get());


    }
    // 集合用法 https://www.cnblogs.com/47Gamer/p/13684194.html

}

class MyThread implements Callable<String>
{
    @Override
    public String call() throws Exception
    {
        System.out.println("-----come in call() " );
        return "hello Callable";
    }
}
